import time

from appium.webdriver.common.appiumby import AppiumBy
from base.authorize_object import Authorize_Object
from comm.action import CommonDriver
from selenium.webdriver.support.wait import *
from selenium.webdriver.support import expected_conditions as ec


class Authorize_Page(Authorize_Object):
    # 封装操作
    # 点击同意
    @classmethod
    def privacy_agree_button_click(self, driver):
        privacy_agree_button_xpath = self.privacy_agree_button()
        return driver.find_element(AppiumBy.XPATH, privacy_agree_button_xpath).click()

    # 点击同意
    @classmethod
    def authorize_agree_button_click(self, driver):
        authorize_agree_button_click_path = self.authorize_agree_button()
        return driver.find_element(AppiumBy.XPATH, authorize_agree_button_click_path).click()

    @classmethod
    def a_agree_button_click(self,driver):
        a_agree_button_click_path=self.a_agree_button()
        return driver.find_element(AppiumBy.XPATH,a_agree_button_click_path).click()

    @classmethod
    def b_agree_button_click(self,driver):
        b_agree_button_click_path=self.b_agree_button()
        return driver.find_element(AppiumBy.XPATH,b_agree_button_click_path).click()

    @classmethod
    def c_agree_button_click(self,driver):
        c_agree_button_click_path=self.c_agree_button()
        return driver.find_element(AppiumBy.XPATH,c_agree_button_click_path).click()

    @classmethod
    def d_agree_button_click(self,driver):
        d_agree_button_click_path=self.d_agree_button()
        return driver.find_element(AppiumBy.XPATH,d_agree_button_click_path).click()

    # 组装操作步骤---
    @classmethod
    def authorize_setup(self, driver):
        self.privacy_agree_button_click(driver)
        self.authorize_agree_button_click(driver)
        self.a_agree_button_click(driver)
        time.sleep(5)
        self.b_agree_button_click(driver)
        self.c_agree_button_click(driver)
        self.d_agree_button_click(driver)

if __name__ == '__main__':
    driver = CommonDriver().get_driver()
    Authorize_Page().authorize_setup(driver=driver)
